/*
 * @Description:用于点击复制内容
 * @Autor: Bingo
 * @Date: 2024-07-10 16:17:40
 * @LastEditors: Bingo
 * @LastEditTime: 2024-08-12 11:28:27
 */
export default {
  beforeMount(el: any, binding: any, vnode: any) {
    el._copyTextHandler = async (e: any) => {
      e.stopPropagation();
      try {
        await navigator.clipboard.writeText(binding.value);
      } catch (err) {
      }
    };

    el.addEventListener("click", el._copyTextHandler);
  },

  unmounted(el: any) {
    el.removeEventListener("click", el._copyTextHandler);
  },
};
